export const heartCheck = {
  timeout: 10000,
  timer: null,
  serverTimer: null,
  reset() {
    clearTimeout(this.timer);
    clearTimeout(this.serverTimer);
    return this;
  },
  start() {
    this.timer = setTimeout(() => {
      my.sendSocketMessage({
        data: 'ping',
        success() {
          console.log("发送ping成功");
        },
        fail() {
          console.log("发送ping失败");
        }
      });
      this.serverTimer = setTimeout(() => {
        my.closeSocket();
      }, 5000);
    }, this.timeout);
  }
}